#!/usr/bin/env bash
backupdir=/data/hs_hhcd/backdatabases
#backupdir=$(cd $(dirname $(dirname $0)) && cd ../backdatabases && pwd )
time=` date +%Y%m%d_%H%M%S `
#备份数据库,期望每天2:00执行
mysqldump --defaults-extra-file=/etc/my.cnf wework_huihua > $backupdir/wework_huihua_$time.sql
mysqldump --defaults-extra-file=/etc/my.cnf wework_huihua | gzip > $backupdir/wework_huihua_$time.sql.gz
#删除90天之前的备份
find $backupdir -name "wework_huihua_*.sql*" -type f -mtime +90 -exec rm {} \; >/dev/null 2>&1
